package com.sina.shop.config;

import com.sina.shop.dao.config.DaoConfig;
import com.sina.shop.util.Constant;
import org.springframework.context.annotation.*;
import org.springframework.context.support.ResourceBundleMessageSource;


/**
 * Created with IntelliJ IDEA.
 * Description:
 * 段浩杰   2017-09-21-18:47
 */
@Configuration
@Import({DaoConfig.class})
@ComponentScan({"com.sina.shop.dao", "com.sina.shop.service"})
public class ServiceConfig {
    @Bean
    public ResourceBundleMessageSource serviceLayerMessageSource() {
        ResourceBundleMessageSource resourceBundleMessageSource = new ResourceBundleMessageSource();
        resourceBundleMessageSource.setDefaultEncoding( Constant.UTF8 );
        resourceBundleMessageSource.setBasename( "i18n/service/messages" );
        resourceBundleMessageSource.setUseCodeAsDefaultMessage( true );
        return resourceBundleMessageSource;
    }
}
